package com.lagou.edu.service.impl;

import com.lagou.edu.dao.entity.User;
import com.lagou.edu.dao.repository.UserRepository;
import com.lagou.edu.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @author bobcheng
 * @date 2020/7/13
 */
@Service
public class LoginServiceImpl implements LoginService {

    @Autowired
    private UserRepository userRepository;

    @Override
    public boolean login(String email, String password) {
        User user = userRepository.findTopByEmailAndPassword(email, password);
        return Objects.nonNull(user);
    }

}
